
**DTC STI Analysis
use "D:\OneDrive - UNSW\UNC\DTC STI Paper\Data\Data from Survey Solution\dtc_case8&9_final.dta"
use "C:\Users\z5288608\OneDrive - UNSW\UNC\DTC STI Paper\Data\Data from Survey Solution\dtc_case8&9_final.dta"

**working on dku campus
cd "C:\Users\ys402\Stata"
use "C:\Users\ys402\OneDrive - UNSW\UNC\DTC STI Paper\Data\Data from Survey Solution\dtc_case8&9_final.dta"


****description
mean m_r_qe_pct m_e_qe_pct mcorrdiag corr_management p_corr_management m_refer sti_exam drug if mode==0
mean m_r_qe_pct m_e_qe_pct mcorrdiag corr_management p_corr_management m_refer sti_exam drug if mode==1
mean m_r_qe_pct m_e_qe_pct mcorrdiag corr_management p_corr_management m_refer sti_exam drug

mean m_r_qe_pct m_e_qe_pct mcorrdiag corr_management p_corr_management m_refer sti_exam drug if case==8
mean m_r_qe_pct m_e_qe_pct mcorrdiag corr_management p_corr_management m_refer sti_exam drug if case==9


**Figure 1
stripplot m_r_qe_pct, over(mode) stack h(0.5) bar(lcolor(red)) name(a1, replace) ///
xtitle("") ytitle ("") subtitle ("Panel A: Adherence to checklists, p-value < 0.001", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot m_e_qe_pct, over(mode) stack h(0.5) bar(lcolor(red)) name(a2, replace) ///
xtitle("") ytitle ("") subtitle ("Panel B: Adherence to essential checklist, p-value = 0.025", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot mcorrdiag, over(mode) stack h(0.5) bar(lcolor(red)) name(a3, replace) ///
xtitle("") ytitle ("") subtitle ("Panel C: Correct diagnosis, p-value < 0.001", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot corr_management, over(mode) stack h(0.5) bar(lcolor(red)) name(a4, replace) ///
xtitle("") ytitle ("") subtitle ("Panel D: Correct management, p-value = 0.596", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot p_corr_management, over(mode) stack h(0.5) bar(lcolor(red)) name(a5, replace) ///
xtitle("") ytitle ("") subtitle ("Panel E: Partially correct management, p-value = 0.196", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot  m_refer, over(mode) stack h(0.5) bar(lcolor(red)) name(a6, replace) ///
xtitle("") ytitle ("") subtitle ("Panel F: Referral, p-value = 0.237", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot  sti_exam, over(mode) stack h(0.5) bar(lcolor(red)) name(a7, replace) ///
xtitle("") ytitle ("") subtitle ("Panel G: STI test, p-value = 0.241", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))

stripplot drug, over(mode) stack h(0.5) bar(lcolor(red)) name(a8, replace) ///
xtitle("") ytitle ("") subtitle ("Panel H: Drug prescription, p-value = 0.023", size(small) justification(left)) ///
ylabel(0 "Video-based" 1 "Text-based", labcolor(black) labsize (small))


*adjustment
	eststo clear
	
	glm m_r_qe_pct mode i.case open reservation consultationfee gender department i.profession1, family(binomial) link(logit) vce(cluster m_platform_code)
	eststo dtc_sti1, title(dtc_sti1): margins, dydx(*) post
	glm m_e_qe_pct mode i.case open reservation consultationfee gender department i.profession1, family(binomial) link(logit) vce(cluster m_platform_code)
	eststo dtc_sti2, title(dtc_sti2): margins, dydx(*) post
	probit  mcorrdiag  mode i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti3, title(dtc_sti3): margins, dydx(*) post
	probit corr_management mode  i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti4, title(dtc_sti4): margins, dydx(*) post

	esttab using dtc_sti_reg1.rtf, replace b (%9.3fc) ci (%9.3fc) ar2(2) wide ///
	mtitle star(* .1 ** .05 *** .01) ///
	keep (mode 9.case open reservation consultationfee gender department 1.profession1)


**figure 3
coefplot dtc_sti1, bylabel(Checklist) || dtc_sti2, bylabel(Essential checklist) || dtc_sti3, bylabel(Correct diagnosis) || dtc_sti4, bylabel(Correct management) ||, xline(0, lcolor(red) lp(dash)) ciopts(recast(rcap)) keep (mode 9.case open reservation consultationfee gender department 1.profession1) byopts(compact cols(2)) ///
coeflabels(mode="Text-based" 9.case="Herpes" open="Open rating" reservation="Medical appointment" consultationfee="Consultation fee" gender="Male physician" department="General medicine" 1.profession1="Chief physician", labcolor(black) labsize (small))
	
	coefplot (quality1 quality4 quality7, label (Consultation time)) (quality2 quality5 quality8, label (Aherence to checklist)) ///
	(quality3 quality6 quality9, label (PCC)) ///
	 (correct1 correct4 correct7, label (Correct diagnosis) axis(2)) (correct2 correct5 correct8, label (Correct drug) axis(2)) ///
	 (correct3 correct6 correct9, label (Referral) axis(2)), ///
	vertical nolabel yline(0, lcolor(red) lp(dash)) ciopts(recast(rcap)) keep(overuse overuse_exam overuse_drug) ///
	grid(between glcolor(grey) glpattern(dash)) legend(position(6) ring(3) row(2)) subtitle ("Panel A", size(large))  ///
	coeflabels(overuse="Total overservice" overuse_exam="Overservice in tests" overuse_drug="Overservice in drugs", labcolor(black) labsize (small)) ///
	ytitle(Time / Item) ytitle(Probability, axis(2)) ylabel(-4(4)8) ylabel(-.25(.25).5, axis(2))
	
	
***adjustment
	eststo clear

	probit m_refer mode i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti5, title(dtc_sti5): margins, dydx(*) post
	probit sti_exam mode i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti6, title(dtc_sti6): margins, dydx(*) post
	probit unnecessary mode i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti7, title(dtc_sti7): margins, dydx(*) post
	probit p_corr_management mode  i.case open reservation consultationfee gender department i.profession1, vce(cluster m_platform_code)
	eststo dtc_sti8, title(dtc_sti8): margins, dydx(*) post
	
	esttab using dtc_sti_reg1.rtf, replace b (%9.3fc) ci (%9.3fc) ar2(2) wide ///
	mtitle star(* .1 ** .05 *** .01) ///
	keep (mode 9.case open reservation consultationfee gender department 1.profession1)


**Figure 4
	coefplot dtc_sti5, bylabel(Referral) || dtc_sti6, bylabel(STI test) || dtc_sti7, bylabel(Drug prescription) || dtc_sti8, bylabel(Partially correct management) ||, xline(0, lcolor(red) lp(dash)) ciopts(recast(rcap)) keep (mode 9.case open reservation consultationfee gender department 1.profession1) byopts(compact cols(2)) ///
coeflabels(mode="Text-based" 9.case="Herpes" open="Open rating" reservation="Medical appointment" consultationfee="Consultation fee" gender="Male physician" department="General medicine" 1.profession1="Chief physician", labcolor(black) labsize (small))
	
	
	
	